<template>
  <div class="example-tb">
  
    <div class="tb">
      <!-- <div class="btns" style="margin-bottom: 10px; text-align: right">
        <el-button type="success" size="small" @click="addApplay"
          ><i class="el-icon-plus"></i>预审申请</el-button
        >

       <el-button type="primary" size="small" @click="getImport"
          ><i class="el-icon-download"></i>导出记录</el-button
        > 
      </div> -->

      <!-- @rowClick单击事件 -->
      <vol-table
        ref="table"
        :columns="columns"
        :max-height="500"
        :columnIndex="false"
        :ck="true"
        :text-inline="false"
        @row-dbclick="rowDbClick"
        :tableData="tableData"
        :paginationHide="true"
      ></vol-table>
    </div>
    <br />
    <VolBox
      :lazy="true"
       v-model="model"
      :title="title"
      :detailParams="detailParams"
      :fistfileName="fistfileName"
      :fistfileUrl="fistfileUrl"
      :first_ssfa_state="first_ssfa_state"
      :first_ssfa_sh="first_ssfa_sh"
      :height="350"
      :width="width"
      :pdfwidth="pdfwidth"
    >
      <div>当前点击的行数据<br>{{currentRow}}</div>
    </VolBox>

    <applyDetail
      :lazy="true"
       v-model="dmodel"
      :title="title"
      :detailParams="detailParams"
      :fistfileName="fistfileName"
      :fistfileUrl="fistfileUrl"
      :first_ssfa_state="first_ssfa_state"
      :first_ssfa_sh="first_ssfa_sh"
      :height="350"
      :width="width"
      :pdfwidth="pdfwidth"
    >
      <div>当前点击的行数据<br>{{currentRow}}</div>
    </applyDetail>
  </div>
</template>
<script>
/*********************此示例采用的vue2语法，也可以使用vue3语法***************************/
import VolTable from "@/components/basic/VolTable.vue";
import VolHeader from "@/components/basic/VolHeader.vue";
import VolBox from "@/views/applyReonly.vue";
import applyDetail from "@/views/applydetail.vue";
import { ref, getCurrentInstance } from "vue";

export default {
  components: {
    VolTable,
    VolBox,
    VolHeader,
    applyDetail
    
  },
  setup() {
  },
  data() {
    var parms={
      sq_sj: this.projectname,
      sh_sj: this.projectname,
      shzt: this.projectname,
      pageindex:this.pageindex,
      pagesize:this.pagesize,
    };

    this.http.post("/api/zm_data_record/GetData", parms).then((result) => {
      console.log(result);
      this.tableData=result.rows;
     });
    return {
      currentRow:'',
      model: false,
      dmodel:false,
      width:'90%',
      pdfwidth:'50%',
      title:"测试",
      detailParams:"",
      fistfileName:"",
      fistfileUrl:"",
      first_ssfa_state:"",
      first_ssfa_sh:"",
      url: "/api/app_news/upload", //使用后台自带的上传文件方法，也可以自定义方法上传
      text: "",
      tableData: [],
      columns: [
        //表配置
        {
          field: "data_id", //数据库表字段,必须和数据库一样，并且大小写一样
          type: "string", //数据类型
          isKey: true, //是否为主键字段
          width: 80, //表格宽度
          hidden: true, //是否显示
          readonly: true,
          require: true,
          align: "left"//文字显示位置left、center
        },

        {
          field: "projectname",
          title: "项目名称",
          type: "string",
          width: 240,
          require: true,
          align: "left",
          cellStyle: (row, rowIndex, columnIndex) => {
            return { color: "#409EFF",cursor:"pointer" };
          },
          click: (row, column) => {
            this.title=row.projectname;
              this.http.post("/api/zm_data_record/AdminGetDetaileByID?id="+row.data_id).then((result) => {
                this.detailParams=result.Data;
                if(result.Data.thisdata!=undefined)
                {
                  this.fistfileName= result.Data.thisdata.ssfa_name;
                  this.fistfileUrl=result.Data.thisdata.ssfa;
                }
                if(result.Data.thisaudit!=undefined){
                  this.first_ssfa_state=result.Data.thisaudit.ssfa_sh_state;
                  this.first_ssfa_sm=result.Data.thisaudit.ssfa_sm;
                  if(result.Data.thisaudit.shzt=="0")
                  {
                    // this.$router.push('/applyrectification?data_id='+ result.Data.thisaudit.data_id );
                    this.dmodel=true;
                    this.model=false;
                    return;
                  }
                }

              });
            this.model=true;
          },
        },
        {
          field: "sqcs",
          title: "申请次数",
          type: "string",
          width: 80,
          align: "center",
          sort: true,
        },
        {
          field: "shzt",
          title: "审核状态",
          type: "string",
          width: 70,
          align: "center",
          sort: true,
        },
        {
          field: "jycs",
          title: "交验次数",
          type: "string",
          width: 100,
          align: "center",
          sort: true,
        },
        {
          field: "xxtj_time",
          title: "线下提交时间",
          type: "datetime",
          width: 90,
          sort: true,
          align: "center",
        },
        {
          field: "create_time",
          title: "申请时间",
          width: 100,
          type: "datetime",
          sort: true,
          align: "center",
        },
        {
          field: "sh_name",
          title: "审核人",
          type: "string",
          width: 90,
          align: "center",
        },
        {
          field: "sh_time",
          title: "审核时间",
          type: "datetime",
          width: 90,
          sort: true,
          align: "center",
        },
      ],
    };
  },
  methods: {
    rowDbClick({ row, column, event }) {

    },
   
    clear() {
      this.tableData.splice(0);
    },
    getImport() {
     
      
    },
    addApplay() {
     
      this.$router.push('/apply');
    },
  },
};
</script>
<style lang="less" scoped>
.example-tb {
  padding: 15px;
}
.tb {
  margin-top: 15px;
}
.v-header {
  background: white;
  padding: 10px;
}
</style>
